<template>
  <div class="app-container">
    <el-table :loading="loading" :data="dataList" @selectionChange="selectionChange" table-layout="auto">
      <el-table-column prop="openId" label="微信OPENID" />
      <el-table-column prop="money" label="红包金额" />
      <el-table-column prop="sendName" label="红包发送者" />
      <el-table-column prop="wishing" label="祝福语" />
      <el-table-column prop="status" align="center" label="状态" width="80px">
        <template #default="scope">
          <el-tag v-if="scope.row.status===0" type="info">未发放</el-tag>
          <el-tag v-if="scope.row.status===1" type="success">发放成功</el-tag>
          <el-tag v-if="scope.row.status===2" type="warning">发放失败</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="remark" label="发放备注" />
      <el-table-column prop="updateTime" label="更新时间" />
      <el-table-column prop="createTime" label="创建时间" />
    </el-table>
    <pagination v-model:page="queryParam.page" v-model:limit="queryParam.size" :total="total" @change="initList()" />
  </div>
</template>

<script setup>
import {toRefs, getCurrentInstance, defineExpose, defineProps, ref} from 'vue'
import Pagination from '@/components/Pagination'
import mixins from "@/mixins/mixins";
import detail from '../user/detail.vue'

const { initList, total, dataList, data, selectionChange, } = mixins()
const { queryParam, loading, baseUrl } = toRefs(data)


const { proxy } = getCurrentInstance();

const title = ref('红包记录')

baseUrl.value = '/userRed'

const props = defineProps({
  userId: 0
});
data.queryParam.userId = props.userId
initList()
const initPage = (id) =>{
  data.queryParam.userId = id
  initList()
}
defineExpose({initPage})
</script>
